home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '87 / Source ƒ.sea / Source ƒ / communications source ƒ / macbinary source / sflib.c < prev   
Encoding:
C/C++ Source or Header  |  1985-10-27  |  1.5 KB  |  78 lines  |  [TEXT/????]

  1. #include "Packages.h"
  2. #include "PBDefs.h"
  3. #include "OSIo.h"
  4.  
  5. Make_Name(vol,srcname,dstname)
  6. short vol;
  7. char *srcname,*dstname;
  8. {    char i;
  9.     VolumeParam pb;
  10.     pb.ioCompletion = 0;
  11.     pb.ioVRefNum = vol;
  12.     pb.ioVolIndex = 0;
  13.     pb.ioNamePtr = dstname;
  14.     PBGetVInfo(&pb,0);
  15.     i=dstname[0]+1;
  16.     dstname[i]=':';
  17.     BlockMove(&srcname[1],&dstname[i+1],srcname[0]);
  18.     dstname[0]=i+srcname[0];
  19.     PtoCstr(dstname);
  20.     return(vol);
  21. }
  22.  
  23. MakeName(r,name)
  24. SFReply *r;
  25. char *name;
  26. {    return(Make_Name(r->vRefNum,&r->Namelength,name));
  27. }
  28.  
  29. SFGetFile(loc,prompt,filter,num,typelist,dlghook,reply)
  30. long loc,filter,dlghook;
  31. short num;
  32. char *reply,*prompt,*typelist;
  33. {    long oldport;
  34.     GetPort(&oldport);
  35. #asm
  36.     MOVE.L    D0,-(SP)    ;location
  37.     MOVE.L    D1,-(SP)    ;Prompt
  38.     MOVE.L    D2,-(SP)    ;FileFilter
  39.     MOVE.W    D3,-(SP)    ;numTypes
  40.     MOVE.L    D4,-(SP)    ;TypeList
  41.     MOVE.L    D5,-(SP)    ;DlgHook
  42.     MOVE.L    D6,-(SP)    ;Reply
  43.     MOVE.W    #2,-(SP)    ;routine selector for GetFile
  44.     DC.W    $A9EA    ;Pack3
  45. #endasm
  46.     SetPort(oldport);
  47.     return(reply[0]);
  48. }
  49.  
  50. SFPutFile(loc,prompt,oldname,dlghook,reply)
  51. long loc,dlghook;
  52. char *prompt,*oldname,*reply;
  53. {    long oldport;
  54.     GetPort(&oldport);
  55. #asm
  56.     MOVE.L    D0,-(SP)    ;location
  57.     MOVE.L    D1,-(SP)    ;Prompt
  58.     MOVE.L    D2,-(SP)    ;OrigName
  59.     MOVE.L    D3,-(SP)    ;DlgHook
  60.     MOVE.L    D4,-(SP)    ;Reply
  61.     MOVE.W    #1,-(SP)    ;routine selector for PutFile
  62.     DC.W    $A9EA    ;Pack3
  63. #endasm
  64.     SetPort(oldport);
  65.     return(reply[0]);
  66. }
  67.  
  68. OldFileName(count,types,reply)
  69. short count;
  70. char *types,*reply;
  71. {    return(SFGetFile(0x00500050,0,0,count,types,0,reply));
  72. }
  73.  
  74. NewFileName(name,reply)
  75. char *name,*reply;
  76. {    return(SFPutFile(0x00500050,"\010Save as:",name,0,reply));
  77. }
  78.